{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from gs_quant.session import Environment, GsSession\n",
    "from gs_quant.instrument import IRSwaption"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# external users should substitute their client id and secret; please skip this step if using internal jupyterhub\n",
    "GsSession.use(Environment.PROD, client_id=None,\n",
    "              client_secret=None, scopes=('run_analytics',))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Construct a midcurve swaption: 6m 2y1y\n",
    "# expiration_date='6m' - option expires in 6m\n",
    "# effective_date='2y' - swap starting 2y after expiry (2.5y after trade)\n",
    "# termination_date='1y' - swap tenor is 1y (swap matures 3.5y post trade)\n",
    "midcurve = IRSwaption(pay_or_receive='Pay', expiration_date='6m',\n",
    "                      effective_date='2y', termination_date='1y')\n",
    "midcurve.price()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# expiration_date can also be specified as IMM date\n",
    "midcurve = IRSwaption(pay_or_receive='Pay', expiration_date='IMM1',\n",
    "                      effective_date='2y', termination_date='1y')\n",
    "midcurve.price()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  },
  "pycharm": {
   "stem_cell": {
    "cell_type": "raw",
    "metadata": {
     "collapsed": false
    },
    "source": []
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
